<?php
$username = array(
	'name'	=> 'username',
	'id'	=> 'username',
	'size'	=> 30,
	'value' => set_value('username')
);

$password = array(
	'name'	=> 'password',
	'id'	=> 'password',
	'size'	=> 30
);

$remember = array(
	'name'	=> 'remember',
	'id'	=> 'remember',
	'value'	=> 1,
	'checked'	=> set_value('remember'),
	'style' => 'margin:0;padding:0'
);

$confirmation_code = array(
	'name'	=> 'captcha',
	'id'	=> 'captcha',
	'maxlength'	=> 8
);

?>
<h3>Login</h3>
<?php echo form_open($this->uri->uri_string())?>

<?php
$w = strlen($this->dx_auth->get_auth_error());
$x = strlen(form_error($username['name']));
$y = strlen(form_error($password['name']));
?>

<?php if(($x + $y + $w)>0): ?>
        	<p class="alert"> Either username or password is incorrect </p>
<?php endif; ?>
<table class="loginTable">
    <tfoot>
      <tr>
        <td colspan="2">
          <?php echo form_submit('login','Login');?>
        </td>
      </tr>
    </tfoot>
    <tbody>
      <tr>
      <th><?php echo form_label('Username', $username['id']);?>:</th>
      <td>
        <?php echo form_input($username)?>
      </td>	
	  </tr>
	  <tr>
      <th><?php echo form_label('Password', $password['id']);?>:</th>
	  <td>
		<?php echo form_password($password); ?>
	  </td>
	  </tr>
	  <?php if ($show_captcha): ?>
	  
	    <?php $z = strlen(form_error($confirmation_code['name'])); ?>
        <?php if($z > 0): ?>
         <tr>
        	<td colspan="2"><p class="alert"> Confirmation Code incorrect </p></td>
	     </tr>
        <?php endif; ?>

      <tr>
		<td colspan="2"><span class="info">Enter the code exactly as it appears. There is no zero.</span>
		 <?php echo $this->dx_auth->get_captcha_image(); ?></td>
	  </tr>
	  <tr>
	  <th><?php echo form_label('Confirmation Code', $confirmation_code['id']);?></th>
	  <td>
			<?php echo form_input($confirmation_code);?>
	  </td>
      </tr>	
	  <?php endif; ?>
	  
	  <tr>
	  <th><?php echo form_label('Remember me', $remember['id']);?> :</th>
      <td>
        <?php echo form_checkbox($remember);?> 
      </td>
      <tr><td colspan="3"><hr /></tr></tr>
	  <tr>
	  <td><?php echo anchor($this->dx_auth->forgot_password_uri, 'Forgot password?', array('class' => 'little_link'));?> </td>
	  <td>
		  <?php if ($this->dx_auth->allow_registration):?>
		  <?php echo anchor($this->dx_auth->register_uri, 'Register',array('class' => 'little_link')); ?>
		  <?php endif; ?>
	  </td>
	  </tr>
    </tr>
    </tbody>
  </table>

<?php echo form_close()?>

